<style type="text/css">
    #menu
    {
        height:30px;
        background-color:pink;
    }

    #menu ul
    {
        margin:0;
        padding:0;
        list-style:none;
    }
    #menu li
    {
        display:inline;
    }
    #menu li a
    {
        text-decoration:none;
        font-size:24px;
        margin-left:30px;
        text-align:center;
        color:#333;
        font-weight:bold;
    }
    #menu li a:hover
    {
        color:white;
    }

</style>
<!DOCTYPE HTML>
<html lang="en">
     <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link type="text/css" rel="stylesheet" href="style1.css"/>


        <title>Sistem Dokumentasi</title>



    </head>
    <body>
        <form name="formcari" method="post" action="prosesSearch.php">
            <table width="330" border="0" align="right" cellpadding="0">

                <tr> <td>  Search </td>
                    <td> <input type="text" name="name"> </td>


                    <td> <input type="SUBMIT" name="SUBMIT" id="SUBMIT" value="search" > </td>
                </tr>
            </table></form>
        <div id="menu">
            <ul>
                <li><a href="Formutama.php">Home</a></li>
                <li><a href="FormDownload.php">Download</a></li>

            </ul>
        </div>
        <center>
        <div id="kotakKategori" >
        <?php
        include "KoneksiDB.php";
        $error = '';
        $name = $_POST['name'];
        $query = "SELECT * FROM upload WHERE name Like '$name'or username like '%$name'or tanggal_penelitian like '$name'";
        $hasil = mysql_query($query);
        $data = mysql_fetch_array($hasil);
        ////get the nama value from form
        if (empty($name)) {
              echo "<center>";
            echo "<h2> Hasil Searching </h2>";
            echo "tidak dapat mencari kata yang dimasukan";
        }
        else 
            {
            $sql = mysql_query("SELECT * FROM upload WHERE name LIKE '%$name%' or username like '%$name'or tanggal_penelitian like '$name' ") or die(mysql_error());

            $result = mysql_num_rows($sql);  //execute the query $q


            echo "<center>";
            echo "<h2> Hasil Searching </h2>";
            while ($data = mysql_fetch_array($sql)) {
//
                echo "<li><a href='download.php?id=" . $data['id'] . "'>" . $data['name'] . "</a> ";
                echo " peneliti : " .$data['username'] ;
                echo "</ul>";
            }
        }
        
//$name = $_POST['name']; //get the nama value from form
//$q = "SELECT * from upload where name like '%$name%'or username like '%$name%'"; //query to get the search result
//$result = mysql_query($q); //execute the query $q
//
//echo "<center>";
//echo "<h2> Hasil Searching </h2>";
//
//
//while ($data = mysql_fetch_array($result)) {
//
//                    echo "<li><a href='download.php?id=" . $data['id'] . "'>" . $data['name'] . "</a> ";
//
//                echo "</ul>";}
//                else{
//                    echo 'data ga ada';
//                }
//while ($data = mysql_fetch_array($result)) {  //fetch the result from query into an array
//    echo "
//<tr>
//
//<td>" . $data['name'] . "</td>
//
//</tr>";
//}
//echo "</table>";
        ?>
        <!-- Akhir dari div menu -->
         

           
        </div>
    </center>
    <div id="footer">
        Sistem Dokumentasi ini dubuat untuk menyelesaikan tugas Proyek Informatika <br/>
        Thomas Haryo-Helanus Octa <br/>
    </div>
    </body>
</html>
